<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登录页面</title>
<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/form/jquery.form.js"></script>
<script type="text/javascript" src="index.js"></script>
<link rel="stylesheet" type="text/css" href="css/login.css" />
<script type="text/javascript">
$(document).ready(function() {
	if ($.getCookie("userDTO.userLoginName") != null && $.getCookie("userDTO.userPwd") != null) {
		$("#userDTO\\.userLoginName").val($.getCookie("userDTO.userLoginName"));
		$("#userDTO\\.userPwd").val($.getCookie("userDTO.userPwd"));
		$("#userDTO\\.userPwd").css('display', 'block');
		$("#userDTO\\.showPwd").css('display', 'none');
	}
});
$.changePassinput = function(th) {
	if (th.id == 'userDTO.userPwd') {
		if (th.value == '' || th.value.length == 0) {
			$("#pwd1").css('display', 'block');
			$("#userDTO\\.userPwd").css('display', 'none');
		}
	} else {
		$("#userDTO\\.userPwd").css('display', 'block');
		$("#pwd1").css('display', 'none');
		$("#userDTO\\.userPwd").focus();
	}
};
$.setCookie = function(name, value) {
	var Days = 30;
	var exp = new Date();
	exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
	document.cookie = name + "=" + escape(value) + ";expires=" + exp.toGMTString();
}
$.getCookie = function(name) {
	var arr, reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");
	if (arr = document.cookie.match(reg))
		return (arr[2]);
	else
		return null;
}
$.loginCheck=function(){
	var tipInfo=document.getElementById("tipInfo");
	var userObj;
	var options = {
			type : 'post',
			dataType : 'text',
			url : 'user/loginCheck.action',
			success : function(msg) {
				if (msg == 0) {
					tipInfo.innerHTML = "用户名或密码错误!";
				}else if(msg == -1){
					tipInfo.innerHTML = "系统错误!";
				}else if(msg == 1){
					var url="page/manager.html?userId=" + msg;
					window.location.href=url;
				}else{
					var url="page/user.html?userId=" + msg;
					window.location.href=url;
				}
			}
		};
	if ($("#userDTO\\.userLoginName").val() == "" || $("#userDTO\\.userLoginName").val() == "用户名") {
		tipInfo.innerHTML = "用户名不能为空";
	}
	else if($("#userDTO\\.userPwd").val() == "") {
		tipInfo.innerHTML = "密码不能为空";
	}else {
		tipInfo.innerHTML = "";
		$("#submitForm").ajaxSubmit(options);
	}
}
$.register = function(){
	window.location.href="page/userRegister.html";
}
</script>
</head>
<body>
<div>
<div id="topDiv">
<div class="logo"><img src="images/earth-globe.png"/></div><div class="logo1">招聘网</div>
<div class="topLink">
<a href="company_login.html">我是企业HR</a>
</div>
</div>
	<div class="content">
		<div class="title ">个人登录</div>
		<div class="tip"><span id="tipInfo"></span></div>
		<form name="submitForm" id="submitForm" method="post">

				<div class="input">
					<input class="input_all name" name="userDTO.userLoginName" id="userDTO.userLoginName" value="用户名" type="text" onblur="if(this.value==''){this.value='用户名'}"
						onfocus="if(this.value=='用户名'){this.value=''}" maxlength="22"/>
						<span id="IdCheckInfo" style="font-size:14px;font-family:'华文楷体';color:#009FCC;margin-left:10px;font-weight:bold;"></span>
                        
				</div>
				<div class="input">
					<input class="input_all password" name="pwd1" id="pwd1" type="text" onfocus="$.changePassinput(this);" value="密码"/>
					<input style="display: none;" class="input_all password" name="userDTO.userPwd" id="userDTO.userPwd" type="password" value="" onblur="$.changePassinput(this);" maxlength="22"/>
					<span id="PwdCheckInfo" style="font-size:14px;font-family:'华文楷体';color:#009FCC;margin-left:10px;font-weight:bold;"></span>
				</div>
				<div class="checkbox">
					<input type="checkbox" name="remember" id="remember" /><label for="remember"><span>记住密码</span></label>
				</div>
				<div class="enter">
					<input class="button" style="margin-left:100px;" name="loginButton" type="button" value="登  录"  onclick="$.loginCheck()"/>
					<input class="button" style="margin-left:25px;" type="button" name="registerButton" value="注    册" onclick="$.register()"/>
				</div>
				
		</form>
	</div>
</div>
</body>
</html>
